﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ESupervision.Models
{
    public class Document
    {

        public int DocumentID { get; set; }

        [Required]
        [Display(Name = "Created By User")]
        public string CreatedByUserId { get; set; }

        [Required]
        [DataType(DataType.DateTime)]
        [Display(Name = "Created Time")]
        public DateTime CreatedTime { get; set; }

        [Required]
        [MaxLength(1000)]
        public string Subject { get; set; }

        [Required]
        [MaxLength(4000)]
        public string Body { get; set; }

        public int AttachmentFileID { get; set; }

        [ForeignKey("CreatedByUserId")]
        public virtual ApplicationUser CreatedByUser { get; set; }

        [ForeignKey("AttachmentFileID")]
        public virtual AttachementFile AttachmentFile { get; set; }

        [InverseProperty("Document")]
        public virtual ICollection<Comment> Comments { get; set; }
    }
}